<?php
namespace Admin\Controller;
use Think\Controller;
class PartTimeController extends Controller {
    public function add(){
        $this->display();
    }
    public function doadd() {
        $Newsmodel=M(parttime);
        $data['title']=I('post.title');
        $data['drupal_version']=I('post.drupal_version');
        $data['project_cycle']=I('post.project_cycle');
        $data['project_status']=I('post.project_status');
        $data['body']=I('post.body');
        $data['create_time']=time();
        $data['uid']=session('id');       
        $Newsmodel->data($data)->add();
        $this->redirect('Admin/partTime/lists');
    }
    public function lists() {
        $Newsmodel=M(parttime);
        $data=$Newsmodel
                ->table('__PARTTIME__ p ,__USER__ u')
                ->where('p.uid=u.id')
                ->field('p.*,u.name')        
                ->select();    
        $this->assign('data',$data);
        $this->display();
    }
    public function delete() {
        $Newsmodel=M(parttime);
        $map['id']=I('get.id');
        $Newsmodel->where($map)->delete();
        $this->redirect('Admin/partTime/lists');
    }
    public function update() {
        $Newsmodel=M(parttime);
        $map['id']=I('get.id');
        $data=$Newsmodel->where($map)->find();
        $this->assign('data',$data);
        $this->display();
    }
     public function doupdate() {
        $Newsmodel=M(parttime);
        $map['id']=I('post.id');
        $data['title']=I('post.title');
        $data['drupal_version']=I('post.drupal_version');
        $data['project_cycle']=I('post.project_cycle');
        $data['project_status']=I('post.project_status');
        $data['body']=I('post.body');
        $data['update_time']=time();           
        $Newsmodel->where($map)->save($data);
        $this->redirect('Admin/partTime/lists');
    }   
}